<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增材料申请单')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-requisitiones-add" th:object="${pId}">
            <div class="form-group">    
                <label class="col-sm-3 control-label">材料类型：</label>
                <div class="col-sm-8">
                    <select id="matType" name="matTypes" class="form-control noselect2 selectpicker" type="text"></select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">材料分类：</label>
                <div class="col-sm-8">
                    <select  id="matClassification" name="matClassifications" class="form-control" type="text"></select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">材料数据：</label>
                <div class="col-sm-8">
                    <select  id="matData" name="matDatas" class="form-control" type="text"></select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">材料详情：</label>
                <div class="col-sm-8">
                    <select id="matDetails" name="matDetailss" class="form-control" type="text"></select>
                </div>
            </div>
<!--            <div class="form-group">-->
<!--                <label class="col-sm-3 control-label">总览：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input id="a" name="a" class="form-control" type="text"></input>-->
<!--                </div>-->
<!--            </div>-->
            <div class="form-group">    
                <label class="col-sm-3 control-label">材料数量：</label>
                <div class="col-sm-8">
                    <input id="matNumbers" name="matNumbers" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group" hidden>
                <label class="col-sm-3 control-label">申请人：</label>
                <div class="col-sm-8">
                    <input id="mPeoples" name="mPeoples" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group" style="display: none">
                <label class="col-sm-3 control-label">状态：</label>
                <div class="col-sm-8" style="display: none">
                    <select id="mStatus" name="mStatus" th:with="type=${@dict.getType('mate_status')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}">
                    </select>
<!--                    <div class="radio-box">-->
<!--                        <input type="radio" name="mStatus" value="">-->
<!--                        <label th:for="mStatus" th:text="未知"></label>-->
<!--                    </div>-->
<!--                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>-->
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">创建时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input id="mMtime" name="mMtime" class="form-control" placeholder="yyyy-MM-dd" type="text">
                    </div>
                </div>
            </div>
            <div class="form-group"  style="display: none">
                <label class="col-sm-3 control-label">审批意见：</label>
                <div class="col-sm-8">
                    <input id="mOpinions" name="mOpinions" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group" hidden>
                <label class="col-sm-3 control-label">项目外键：</label>
                <div class="col-sm-8">
                    <input id="mId" name="mId" class="form-control" type="text"  th:value="${pId}">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
        var idss=[[*{pId}]];
        var prefix = ctx + "ruoyi/requisitiones"
        var prefixs = ctx +"ruoyi/plan";
        $("#form-requisitiones-add").validate({
            focusCleanup: true
        });
        //s()
         uplike();
        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-requisitiones-add').serialize());
            }
        }

        $("input[name='mMtime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });


        function uplike(){
            $.ajax({
                url: prefixs + "/like/"+idss,
                type: "post",
                dataType:"json",
                data: {},
                success: function(data){
                    if(data.length>0){
                        for(i in data){
                            $("#matType").append("<option>"+data[i].matType+"</option>")
                            $("#matClassification").append("<option>"+data[i].matClassification+"</option>")
                            $("#matData").append("<option>"+data[i].matData+"</option>")
                            $("#matDetails").append("<option>"+data[i].matDetails+"</option>")
                        }
                    }else{
                        $("#matType").append("<option>暂无数据</option>")
                        $("#matClassification").append("<option>暂无数据</option>")
                        $("#matData").append("<option>暂无数据</option>")
                        $("#matDetails").append("<option>暂无数据</option>")
                    }
                        // var matType = $("#matType option:selected").text();
                        // var matClassification = $("#matClassification option:selected").text();
                        // var matData = $("#matData option:selected").text();
                        // var matDetails = $("#matDetails option:selected").text();
                        // var zonglan = matType + "-" + matClassification + "-" + matData + "-" +matDetails
                        // $("#a").val(zonglan);
                }
            });
        }





        //
        //
        //
        // // jq监听  材料类型
        //
        // function s() {
        //     var a = "请选择材料类型"
        //     $.ajax({
        //         url: prefix + "/plans",
        //         type: "get",
        //         dataType:"json",
        //         data: {},
        //         success: function(data){
        //
        //             if(data.length>0){
        //                 $("#matType").append("<option>"+ a +"</option>")
        //                 for(i in data){
        //                     $("#matType").append("<option>"+data[i].matType+"</option>")
        //                 }
        //             }else{
        //                 $("#matType").append("<option>暂无数据</option>")
        //             }
        //         },
        //     })}
        //
        // //jq监听根据材料类型显示出材料数据
        // function sb1(obj) {
        //     var aname = $(obj).val();
        //     $("#matClassification").html("");
        //     var a = "请选择材料分类"
        //     $.ajax({
        //         url: prefix + "/classmat/" + aname,
        //         type: "get",
        //         dataType:"json",
        //         data: {},
        //         success: function(data){
        //             $("#matData").empty();
        //             if(data.length>0){
        //                 $("#matClassification").append("<option>"+ a +"</option>")
        //                 for(i in data){
        //                     $("#matClassification").append("<option>"+data[i].matClassification+"</option>")
        //                 }
        //             }else{
        //                 $("#matClassification").append("<option>暂无数据</option>")
        //             }
        //         },
        //     })}
        //
        //
        // function sb2(aaa) {
        //     var pname = $(aaa).val()
        //     var a = "请选择材料数据"
        //     $.ajax({
        //         url: prefix + "/like/"+ pname,
        //         type: "get",
        //         dataType:"json",
        //         data: {},
        //         success: function(data){
        //             $("#matDetails").empty();
        //             $("#matData").empty();
        //             if(data.length>0){
        //                 $("#matData").append("<option>"+ a +"</option>")
        //                 for(i in data){
        //                     $("#matData").append("<option>"+data[i].matData+"</option>")
        //                 }
        //             }else{
        //                 $("#matData").append("<option>暂无数据</option>")
        //             }
        //         },
        //     })}
        //
        // function sb3(bbb) {
        //     var dname = $(bbb).val()
        //     var a = "请选择材料详情"
        //     $.ajax({
        //         url: prefix + "/love/"+ dname,
        //         type: "get",
        //         dataType:"json",
        //         data: {},
        //         success: function(data){
        //             $("#matDetails").empty();
        //             if(data.length>0){
        //                 $("#matDetails").append("<option>"+ a +"</option>")
        //                 for(i in data){
        //                     $("#matDetails").append("<option>"+data[i].matDetails+"</option>")
        //                 }
        //             }else{
        //                 $("#matDetails").append("<option>暂无数据</option>")
        //             }
        //         },
        //     })}
        //
        // function sb4() {
        //     var matType = $("#matType option:selected").text();
        //     var matClassification = $("#matClassification option:selected").text();
        //     var matData = $("#matData option:selected").text();
        //     var matDetails = $("#matDetails option:selected").text();
        //     var zonglan = matType + "-" + matClassification + "-" + matData + "-" +matDetails
        //     $("#a").val(zonglan);
        // }
    </script>
</body>
</html>